#include "widget.h"
#include "ui_widget.h"
#include "QTimer"
#include "QDebug"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    ui->progressBar->setValue(0);

    timer=new QTimer(this);
    connect(timer,&QTimer::timeout,this,&Widget::handle);
    timer->start(100);

}

Widget::~Widget()
{
    delete ui;
}

void Widget::handle()
{
    int value=ui->progressBar->value();
    if(value<100)
    {
        value++;
        ui->progressBar->setValue(value);
    }
    else
    {
        qDebug()<<"完成"<<endl;
        timer->stop();
        return;
    }
}

